package com.thirtydays.frame.util.ext

import com.blankj.utilcode.util.GsonUtils

/**
 * @创建者：小垚
 * @时间：2021/7/2211:33
 * @描述：
 **/
fun Any.gToJson(): String = GsonUtils.toJson(this)

inline fun <reified T> String.gToBean(): T? = GsonUtils.fromJson(this, T::class.java)


inline fun <reified T> String.gToList(): List<T> {
    return GsonUtils.fromJson(this, GsonUtils.getListType(T::class.java))
}

inline fun <reified T> T.deepCopy(): T {
    return GsonUtils.fromJson(GsonUtils.toJson(this), T::class.java)
}
